package com.erik.lin.activemq.listener;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;

/**
 * Created by Erik on 2017/4/26.
 */
public class QueueMessageListener implements MessageListener {

    private static Logger LOG = LoggerFactory.getLogger(QueueMessageListener.class);

    @Override
    public void onMessage(Message message) {
        TextMessage tm = (TextMessage) message;
        try {
            LOG.info("QueueMessageListener监听到了文本消息: {}", tm.getText());
            //do something ...
        } catch (JMSException e) {
            e.printStackTrace();
        }
    }
}
